import 'EnumDefine.dart';

class VideoProfile {
  /// The Constructor for setting fps and bitrate only, maxKeyFrameInterval is 3 * reqFps as default.
  VideoProfile(this.reqFps, this.reqBitrate, { int maxKeyFrameInterval, this.h264Profile = H264Profile.BASELINE, this.avcc = true }) :
    this.maxKeyFrameInterval = maxKeyFrameInterval ?? reqFps*3;
  
  /// Maximum GOP size.
  final int	maxKeyFrameInterval;
  /// The request bitrate.
  final int	reqBitrate;
  /// The request fps.
  final int	reqFps;
  /// h264Profile
  final H264Profile h264Profile;
  /// avcc
  final bool avcc;
  
  @override
  String toString() {
    return "VideoProfile: [${this.reqFps}fps,${this.reqBitrate}bps, GOP:${this.maxKeyFrameInterval},${this.h264Profile},avcc=${this.avcc}]";
  }

  Map<String, dynamic> toJson() {
    return {
      "maxKeyFrameInterval": maxKeyFrameInterval,
      "reqBitrate": reqBitrate,
      "reqFps": reqFps,
      "h264Profile": h264Profile?.index,
      "avcc": avcc,
    };
  }
}